/***************************************************
> Copyright (C) 2024 ==LENA== All rights reserved.
> File Name: 7.15上.c
> Author: lena
> Mail:lena_li@126.com
> Created Time: 2024年07月14日 星期日 19时22分13秒
***************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
typedef struct move {
	char  name[20];
	int id;
	float grade;
}mov;

struct bu{
	mov pe;
	struct bu *next; //指向下一个节点的指针
};


struct bu*cre(void);   //创建节点
struct bu* crect(struct bu*  head); //创建链表
void out( struct bu* head); //链表输出
struct bu*del(struct bu* head);
struct bu* delay(struct bu* head);

int main(int argc,const char* argv[]){
	struct bu* head=NULL;
	head=cre();
	head=crect(head);
	printf("链表中的信息:\n");
	struct bu* temp=NULL;
		temp=head->next;
	while(temp!=NULL){
		printf(" %s\n %d\n %f\n",temp->pe.name,temp->pe.id,temp->pe.grade);
		temp=temp->next;
	}
	return 0;
} 
//创建节点
struct bu *cre(void){
	struct bu* head=NULL;
	head=(struct bu*)malloc(sizeof(struct bu));
	memset(head,0,sizeof(struct bu));
	head->next =NULL;
	return head;
}
//创建链表
struct bu* crect(struct bu* head){
//	assert (head !=NULL);
	int i=0;
	struct bu* temp=head;
	for(i=1;i<=3;i++){

		struct bu* new=(struct bu*)malloc(sizeof(struct bu));
		memset(new,0,sizeof(struct bu*));
		scanf("%s",new->pe.name);
		scanf("%d",&(new->pe.id));
		scanf("%f",&(new->pe.grade));
		new->next =NULL;
		temp->next=new;
		temp = temp->next;
	}
	return head;
}

struct bu*del(struct bu* head){
assert (head !=NULL);
struct bu*bef=head;
struct bu*cur=NULL;
struct bu*temp=head;
while(head!=NULL){
	if(temp->pe.name==1){
	cur=temp;
	bef->next=cur->next;
	free(cur);
	cur=NULL;
	}
	bef=temp;
	temp=temp->next;
}
return head;
	}
//修改链表中的成员数据
struct bu* delay(struct bu* head) {
	assert(head!=NULL);
	struct bu* p = head->next;
	while (p!=NULL)
	{
			if(p->pe.id == 3)
			{
						strcpy(p->pe.id,"yyf");
								}
					p = p->next;
						}
		return head;
}
